#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
    int i, j;
    int flag;
    int arr[30] = { 0 };
    srand((unsigned int)time(NULL));

    for (i = 0; i < 30; i++)
    {
        flag = 0;
        arr[i] = rand() % 30 + 1;
        for (j = 0; j < i; j++)
        {
            if (arr[i] == arr[j])
            {
                flag = 1;
                break;
            }
        }
        if (flag == 1)
        {
            i--;
        }
    }

    for (i = 0; i < 30; i++)
    {
        printf("arr[%d] = %d\n", i, arr[i]);
    }

    return 0;
}